<%@ page language="java" pageEncoding="utf-8"%>
<%@ page language="java" import="java.util.*" %>

<%@ page import="org.net.device.*,
org.net.device.info.*,
net.sf.json.*"
%>
<jsp:directive.page import="org.dolphin.base.jsontools.JsonConverter"/>
<jsp:directive.page import="org.dolphin.base.jsontools.JSONExchangeData"/>
<jsp:directive.page import="org.dolphin.base.jsontools.JSONDao"/>
    <% 
	    request.setCharacterEncoding("utf-8");
    	String qs = request.getParameter("dv");
    	qs = new String(qs.getBytes("ISO-8859-1"),"utf-8");
    	System.out.println("2   "+qs);
    	JSONObject jsonobj3 = JSONObject.fromObject(qs);
    	deviceinfo info = (deviceinfo)JSONObject.toBean(jsonobj3,deviceinfo.class);
    	System.out.println(info.getId()+"   "+info.getIp());
		String sss = JsonConverter.getJsonFieldString(jsonobj3);
		System.out.println(sss);
		devicemanager d = new devicemanager();
		d.setDs(org.dolphin.base.data.provider.JDBCFactory.DataSource());
			System.out.println(jsonobj3.toString());
		if (JSONDao.update(d.getDs(),"deviceinfos",deviceinfo.class,"id",jsonobj3)) {

			JSONExchangeData redata = new JSONExchangeData();
			redata.setCode(0);
			redata.setMessages("操作成功完成");
			System.out.println(JSONObject.fromObject(redata).toString());									
			out.print(JSONObject.fromObject(redata).toString());
		} else {
			JSONExchangeData redata = new JSONExchangeData();
			redata.setCode(-1);
			redata.setMessages("操作失败，请重试");									
			out.print(JSONObject.fromObject(redata).toString());
		}
    %>
